/**
 * 分组报表数据请求
 *
 * @版权所有 rem.studio
 */
import { queryProduct } from '@/services/chartApi';

export default {
  namespace: 'groupChart',

  state: {
    data: {
      list: [],
      pagination: {}
    }
  },

  effects: {
    *fetch({ payload }, { call, put }) {
      const response = yield call(queryProduct, payload);
      yield put({
        type: 'save',
        payload: response
      });
    }
  },

  reducers: {
    save(state, action) {
      return {
        ...state,
        data: action.payload.data
      };
    }
  }
};
